package com.tuxianchao.demo.springbootjdbctemplatedatasource.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author
 * @create 2018-04-15 20:33
 **/
@RestController
public class TestController {
    @Autowired
    @Qualifier("jdbcTemplateOne")
    private JdbcTemplate jdbcTemplateOne;
    @Autowired
    @Qualifier("jdbcTemplateTwo")
    private JdbcTemplate jdbcTemplateTwo;

    @GetMapping("/test01")
    public Object test01() {
        jdbcTemplateOne.execute("SELECT * FROM tbl_user");
        return "index";
    }

    @GetMapping("/test02")
    public Object test02() {
        jdbcTemplateTwo.execute("SELECT * FROM tbl_user");

        return "index";
    }
}
